package org.aplikator.server.rpc.handler;

import org.aplikator.client.rpc.impl.GetFunction;
import org.aplikator.client.rpc.impl.GetFunctionResponse;
import org.aplikator.server.Context;
import org.aplikator.server.DescriptorRegistry;
import org.aplikator.server.descriptor.Function;
import org.aplikator.server.rpc.CommandHandler;

public class GetFunctionHandler implements CommandHandler<GetFunction, GetFunctionResponse> {

    public GetFunctionResponse execute(GetFunction command, Context ctx) {

        Function function = (Function) DescriptorRegistry.get().getDescriptionItem(command.getId());
        return new GetFunctionResponse(function.getFunctionDTO(ctx));
    }

}
